{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b,4,5\n"
     ]
    }
   ],
   "source": [
    "# a=1\n",
    "# b=2\n",
    "# c=3\n",
    "# #and or not\n",
    "# if(a>b and a>c):\n",
    "#     print(\"a>b\")\n",
    "# else:\n",
    "#     print(\"a<b\")\n",
    "\n",
    "# if(a<b<c):\n",
    "#     print(\"a<b<c\")\n",
    "# else:\n",
    "#     print(\"a>b或者b>c\")\n",
    "\n",
    "# print(not a>b)\n",
    "# #三元运算符\n",
    "# print(\"a>b\" if a>b else \"a<b\")\n",
    "# #嵌套循环\n",
    "# i=1\n",
    "# while i<10:\n",
    "#     j=0\n",
    "#     while j<10:\n",
    "#         print(i,j)\n",
    "#         j+=1\n",
    "#     i+=1\n",
    "# #for 循环 range()函数\n",
    "# for i in range(1,10):\n",
    "#     print(i)\n",
    "# #encode 和 decode\n",
    "# str=\"我是王五\"\n",
    "# print(str.encode())\n",
    "# print(str.encode().decode())\n",
    "# # *重复输出\n",
    "# str=\"我是王五\\n\"\n",
    "# print(str*3)\n",
    "\n",
    "# str=\"我是王五\"\n",
    "# #从左往右取 下标从0开始\n",
    "# #从右往左取 下标从-1开始 ，-2，-3\n",
    "# print(str[0])\n",
    "# print(str[-2])\n",
    "# #切片 [start:end:step] 包前不包后\n",
    "# print(str[0:3:2])\n",
    "# print(str[::-1])#倒序输出\n",
    "#find()函数 index()函数 count()函数\n",
    "#str=\"我是王五\"\n",
    "# print(str.find(\"林\"))\n",
    "# print(str.find(\"林1\"))#找不到返回-1\n",
    "# print(str.index(\"林\"))\n",
    "# print(str.index(\"林1\"))#找不到报错\n",
    "# print(str.count(\"林\"))#返回出现的次数\n",
    "# print(str.__len__())#返回长度\n",
    "# #replace()函数  replace(old,new,count) old表示要替换的字符，new表示替换的字符，count表示替换的次数  count默认为全部替换\n",
    "#spilt()函数     split(sep,maxsplit) sep表示分隔符，maxsplit表示最大分割次数  maxsplit默认为全部分割  返回一个列表\n",
    "# str=\"我是,王五\"\n",
    "# print(str.split(\",\"))\n",
    "# str=\"hello word\"\n",
    "# print(str.upper())\n",
    "# print(str.lower())\n",
    "# print(str.capitalize())#首字母大写\n",
    "# print(str.title())#每个单词首字母大写\n",
    "# print(str.strip())#去除字符串两端的空格\n",
    "# print(str.lstrip())#去除字符串左边的空格\n",
    "# print(str.rstrip())#去除字符串右边的空格\n",
    "# print(str.find(\"o\"))#查找字符串中o的位置\n",
    "# print(str.find(\"o\",3))#查找字符串中o的位置，从第3个字符开始查找\n",
    "# print(str.find(\"o\",3,5))#查找字符串中o的位置，从第3个字符开始查找，查找到第5个字符结束\n",
    "# print(str.index(\"o\"))#查找字符串中o的位置\n",
    "# 列表：格式为[元素1,元素2,元素3]，元素可以是任意类型\n",
    "# 列表可以修改，可以删除，可以添加  \n",
    "# list=[1,2,3,4,5]\n",
    "# list.append(6)#在列表末尾添加元素\n",
    "# list.insert(0,0)#在列表指定位置添加元素\n",
    "# list.extend([7,8,9])#在列表末尾添加多个元素\n",
    "# list[0]=10#修改列表指定位置的元素\n",
    "# list.remove(1)#删除列表中第一个出现的指定元素\n",
    "# list.pop(0)#删除列表中指定位置的元素，并返回该元素\n",
    "# list.pop()  #删除列表中最后一个元素，并返回该元素\n",
    "# list.clear()#清空列表\n",
    "# list.reverse()#反转列表\n",
    "# list.sort()#排序列表\n",
    "# list2=[1,2,3,4,5]\n",
    "# print( 1 in list2)\n",
    "# print( 1 not in list2)\n",
    "# print(list2.index(1)) #返回元素在列表中的位置\n",
    "# print(list2.count(1))   #返回元素在列表中出现的次数\n",
    "# print(list2.copy()) #返回列表的浅拷贝\n",
    "# print(list2.__len__()) #返回列表的长度\n",
    "# # 列表可以嵌套    [1,[2,3],4]\n",
    "# #print(list2[1][0]) #返回列表中第二个元素中的第一个元素\n",
    "# # 列表可以切片     [start:end:step]\n",
    "# # 列表可以排序    sort()函数\n",
    "# # 列表可以统计  count()函数\n",
    "# #列表遍历\n",
    "# for i in list2:\n",
    "#     print(i)\n",
    "# #列表推导式\n",
    "# list3=[i for i in range(1,10)]\n",
    "# list4=[i for i in range(1,10) if i%2==0]#筛选出列表中偶数\n",
    "list2={1,2,3,4,5}\n",
    "my_set = {4, 5, 'b'}\n",
    "result = ','.join(map(str, my_set))\n",
    "print(result)  # 输出类似：\"b,4,5\" ‌:ml-citation{ref=\"3,5\" data=\"citationList\"}\n",
    "#map()函数  map(function,iterable) function表示函数，iterable表示可迭代对象，返回一个迭代器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
